package Sunday;

//这个类使用来对算法进行性能测试的类
public class Text {
    public static void main(String[] args) {

        String a="wordkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" +
                "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkwork";
        String b="work";

        SundayText find=new SundayText();
        long startTime = System.currentTimeMillis(); //获取开始时间
        int i=0;
        for(int j=0;j<1000000;j++) {
            i = find.OldSunday(a, b);
        }
        long endTime = System.currentTimeMillis(); //获取结束时间
        System.out.println("匹配位置"+i);
        System.out.println("旧算法运行时间为："+(endTime - startTime) + "ms");

        for (int j=0;j<1000000;j++){
            i=find.NewSunday(a,b);
        }
        System.out.println("匹配位置"+i);
        System.out.println("新算法的时间为："+(System.currentTimeMillis()-endTime)+"ms");
    }
}
